<template>
  <view class="content">
    <view class="body">
      <view class="primary_option">
        <view
          class="option"
          @click="showMore"
          :class="{ option_close: !clickedPrimary }"
        >
          <label class="label">{{ options.title }}</label>
          <text class="text">{{ checkedSecondary ? "v" : ">" }}</text>
        </view>
      </view>
      <tertiary-options
        v-if="options.content"
        :content="options.content"
        :clickedPrimary="clickedPrimary"
        :checkedSecondary="checkedSecondary"
      ></tertiary-options>
    </view>
  </view>
</template>

<script>
import TertiaryOptions from "@/components/introduce/TertiaryOptions.vue";
export default {
  name: "options",
  props: {
    options: Object,
    clickedPrimary: Boolean,
  },
  mounted() {
    // console.log(this.options);
  },
  components: {
    TertiaryOptions,
  },
  data() {
    return {
      checkedSecondary: false,
    };
  },
  methods: {
    showMore() {
      this.checkedSecondary = !this.checkedSecondary;
    },
  },
  computed: {
    getStatus() {
      if (!this.clickedPrimary) {
        this.checkedSecondary = false;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  .body {
    padding: 0 20rpx;

    .primary_option {
      .option {
        opacity: 1;
        border-bottom: 2rpx solid #dbdbdb;
        height: 8vh;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: all 0.4s ease;
        .label {
          padding-left: 10rpx;
          font-size: 32rpx;
          color: #464545;
        }
        .text {
          font-size: 38rpx;
          color: #888888;
        }
      }
      .option_close {
        height: 0;
        transition: all 0.4s ease;
        overflow: hidden;
        border: none;
        opacity: 0;
      }
    }
  }
}
.close {
  display: none;
  transition: all 0.4s cubic-bezier(0.25, 1, 0.25, 1);
}
</style>